<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>Document</title>
		<script type="text/javascript" src="base.js"></script>
		<script>
			window.onload = function() {
				//贪吃蛇 
				//首先for循环一个任意行列数的表格
				var tab = document.getElementById("tab");
				for (var i = 0; i < 20; i++) {
					var tr = document.createElement("tr");
					for (var k = 1; k < 20; k++) {
						var td = document.createElement("td");
						tr.appendChild(td);
					}
					tab.appendChild(tr);
				}
			};
		</script>
		<style>
			#tab{
				margin: 0 auto;
			}
			#tab td{
				width: 30px; height: 30px;
			}
		</style>
	</head>

	<body>
		<table border="1" id="tab"></table>
	</body>
</html>